<?php
function iteratorFun(){
    yield 1;
    yield 11;
    yield 22;
    yield 33;
}
$iterator=iteratorFun();
 
foreach($iterator as $v){
    var_dump($v);
}